home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk56
/
rmand
/
mand.doc
< prev
next >
Wrap
Text File
|
1995-03-19
|
7KB
|
181 lines
MAND - a program to display the Mandelbrot set
==============================================
*** WARNING *** *** WARNING *** *** WARNING ***
- If you run this program from CLI, make sure the stack is set
to at least 20,000. Otherwise you will meet the GURU.
*** WARNING *** *** WARNING *** *** WARNING ***
=================================================================
Introduction:
------------
I know there are plenty of Mandelbrot programs for the Amiga, but I
wanted to add another one to the collection. The main purpose of this
program is to speed up the computation of the Mandelbrot set,
especially when the iteration counts are high and there is a lot of
"black" on the screen (the "black" represents the points within the
set).
To accomplish this a recursive algorithm is used. This algorithm was
invented by Peter Trei, whose hobby is to think of recursion
(Remember: "To iterate is human, to recurse divine!"). Although, Peter
thought of his algorithm over a year ago, it took us until now to
write all the code to make this program presantable. Peter wrote most
of the module that draws the set, I wrote the rest.
I know that other people thought of a similar algorithm, in fact one
is mentioned in the Feb/89 issue of Scientific American, but Peter
made up his algorithm without hearing about any of this.
Peter's Algorithm:
-----------------
The basic idea behind Peter's algorithm is this:
- compute the values for the Mandelbrot function around the
boundary of a rectangle (start with the whole screen)
- if the color of the boundary is all the same, fill the
rectangle with that color, and go to the next rectangle
- if more than one color occurs on the boundary, then
divide the rectangle into two smaller rectangles and
apply the algorithm to them
- finally, if the rectangle gets small enough and its boundary
is still not solid, just go back to the old pixel-by-pixel
algorithm.
Cycle detection:
---------------
As you know, while testing a particular point in the plane for
membership in the Mandelbrot set, we go through iteration during
which a positive real number is computed. If this number stays
small, then there is a chance that the point in question lies in the
set. If the number becomes large (bigger than 4), then the point
will not be in the set.
When the iteration limit is set to 1000, potentially 1000 such
real values are computed. It turns out that in many cases, there
is a simple cycle among these values. For example, the numbers
might be:
.5 .56 .67 .5 .56 .67 ... etc
Once a cycle occurs, there is no point in going though 1000
iterations, since we already know the result.
Therefore this program uses a simple algorithm (out of Knuth vol II)
to detect such cycles. Detection of cycles reduces somewhat the
amount of computation needed to test the points that actually
lie inside the Mandelbrot set. The cycle detection becomes more
effective when the iteration limit is high.
About the program:
-----------------
Running this program should be fairly straight forward.
There are two menus: ACTIONS and DISPLAY. The items
for these menus are summarized below:
ACTIONS
START - start computation
SAVE IFF - save current picture to an IFF file
CONTROL - displays the control panel (more on this below)
COORDINATES - diplays the real coordinates of where the mouse
points
ZOOM - allows you to zoom into the picture
ABOUT - some info about the program
QUIT - exit the program
DISPLAY
TOGGLE TITLE - show or hide screen title
CLEAR - clear the screen
CHANGE COLORS - adjust colors
Control:
-------
The following items are present in the CONTROL window:
CornerX - this is the x-coordinate of the upper left
hand corner of the picture.
CornerY - this is the y-coordinate of the upper left
hand corner of the picture
PicWidth - the width of the picture shown. Note that the
aspect ratio is fixed (i.e. the ration of width
to height), even when zooming.
ColorDivisor - this number determines how often the color
changes when the picture is displayed (lower
number means more changes)
Iteration Limit - this is a number of iteration per each point;
maximum number is 1000.
"CornerX", "CornerY" and "PicWith" are normally left un-touched.
They change when you zoom in. However, you can use these to compute
a particular portion of the set, if you know the coordinates.
"ColorDivisor" determines how fast the color changes. This value
should be made larger as you zoom in. This way you will get cleared
bands of color, instead of a mess. However, if you bump the color
divisor to high, the boundary of the entire screen may turn out to be
just one color, and you'll get a blank screen.
I found that it's best to start "ColorDivisor" at 1 or 2, and then
double it for each zoom in.
Iteration limit can be 1000 at most. To detect a cycle memory must be
reserved for holding all the computed values, so I chose 1000 as the
maximum. I find that 200 to 300 iteration per point produce pictures
that are ver nice, and don't take more than few hours to produce.
Other stuff:
-----------
The "Coordinates" menu item is used to find out coordinates of
points inside the Mandelbrot set. I use these values as inputs
into the Julia Set generating programs.
If you have any comments, suggestion or bug reports please
drop me a line. I'm not distributing sources with this program,
but if you'd like to see them let me know and we can arrange
a disk ex-change.
=================================================================
Some legal stuff
---------------
****************************************************************
This program is PUBLIC DOMAIN, that means, you can distribute
it free of charge as long as this notice is included.
Copyright 1989 (c) by Richie Bielak and Peter Trei
****************************************************************
This program was written using the Benchmark Modula-2
system - the best development on the Amiga yet (in my
opinion).
If you have any comments, questions, suggestions or you've
found parameters that make pretty pictures drop me a line.
You can get me:
CIS: 75716,352
PLINK: RICHIEB
SNAIL MAIL:
526 79th Street
Brooklyn, N.Y. 11209
Enjoy....Richie
****EOF***EOF****EOF***